home *** CD-ROM | disk | FTP | other *** search
- /* dump_song.c
- vi:ts=3 sw=3:
- */
-
- /* $Id: dump_song.c,v 4.9 1995/02/14 04:02:28 espie Exp $
- * $Log: dump_song.c,v $
- * Revision 4.9 1995/02/14 04:02:28 espie
- * Nothing
- *
- * Revision 4.9 1995/02/14 04:02:28 espie
- * Nothing
- *
- * Revision 4.8 1995/02/06 14:50:47 espie
- * Changed sample_info.
- *
- * Revision 4.8 1995/02/06 14:50:47 espie
- * Changed sample_info.
- *
- * Revision 4.7 1995/02/01 20:41:45 espie
- * Added color.
- *
- * Revision 4.6 1995/02/01 16:39:04 espie
- * Includes moved to defs.h
- *
- * Revision 4.6 1995/02/01 16:39:04 espie
- * Includes moved to defs.h
- *
- * Revision 4.0 1994/01/11 17:46:01 espie
- * Use virtual windows.
- * No more call to run_in_fg(), use begin_info result instead.
- * Added instrument name as shown per display.c.
- * Use info facility.
- * Amiga support.
- * Very small bug with volume (Lawrence).
- * Added finetune display.
- * Added bg/fg test.
- */
-
- #include "defs.h"
-
- #include <ctype.h>
-
- #include "song.h"
- #include "extern.h"
- #include "channel.h"
-
- ID("$Id: dump_song.c,v 4.9 1995/02/14 04:02:28 espie Exp $")
-
- LOCAL void *handle = 0;
- LOCAL char buffer[80];
- extern char instname[];
-
- /***
- *
- * dump_block/dump_song:
- * shows most of the readable info
- * concerning a module on the screen.
- *
- ***/
-
- LOCAL void dump_block(b)
- struct block *b;
- {
- int i, j;
-
- for (i = 0; i < BLOCK_LENGTH; i++)
- {
- for (j = 0; j < NUMBER_TRACKS; j++)
- {
- sprintf(buffer,"%8d%5d%2d%4d", b->e[j][i].sample_number,
- b->e[j][i].pitch, b->e[j][i].effect,
- b->e[j][i].parameters);
- infos(handle, buffer);
- }
- info(handle, "");
- }
- }
-
- /* make_readable(s):
- * transform s into a really readable string */
-
- LOCAL void make_readable(s)
- char *s;
- {
- char *t, *orig;
-
- if (!s)
- return;
-
- orig = s;
- t = s;
-
- /* get rid of the st-xx: junk */
- if (strncmp(s, "st-", 3) == 0 || strncmp(s, "ST-", 3) == 0)
- {
- if (isdigit(s[3]) && isdigit(s[4]) && s[5] == ':')
- s += 6;
- }
- while (*s)
- {
- if (isprint(*s))
- *t++ = *s;
- s++;
- }
- *t = '\0';
- while (t != orig && isspace(t[-1]))
- *--t = '\0';
- }
-
- void dump_song(song)
- struct song *song;
- {
- int i, j;
- int maxlen;
- static char dummy[1];
-
-
- handle = begin_info(song->title);
- if (!handle)
- return;
-
- dummy[0] = '\0';
- maxlen = 0;
- for (i = 1; i < NUMBER_SAMPLES; i++)
- {
- if (!song->samples[i]->name)
- song->samples[i]->name = dummy;
- make_readable(song->samples[i]->name);
- if (maxlen < strlen(song->samples[i]->name))
- maxlen = strlen(song->samples[i]->name);
- }
- for (i = 1; i < NUMBER_SAMPLES; i++)
- {
- if (song->samples[i]->start || strlen(song->samples[i]->name) > 2)
- {
- char s[3];
-
- s[0] = instname[i];
- s[1] = ' ';
- s[2] = 0;
- infos(handle, s);
- infos(handle, song->samples[i]->name);
- for (j = strlen(song->samples[i]->name); j < maxlen + 2; j++)
- infos(handle, " ");
- if (song->samples[i]->start)
- {
- sprintf(buffer, "%5d", song->samples[i]->length);
- infos(handle, buffer);
- if (song->samples[i]->rp_length > 2)
- {
- sprintf(buffer, "(%5d %5d)",
- song->samples[i]->rp_offset,
- song->samples[i]->rp_length);
- infos(handle, buffer);
- }
- else
- infos(handle, " ");
- if (song->samples[i]->volume != MAX_VOLUME)
- {
- sprintf(buffer, "%3d", song->samples[i]->volume);
- infos(handle, buffer);
- }
- else
- infos(handle, " ");
- if (song->samples[i]->finetune)
- {
- sprintf(buffer, "%3d", song->samples[i]->finetune);
- infos(handle, buffer);
- }
- }
- info(handle, "");
- }
- }
- end_info(handle);
- handle = 0;
- }
-